package com.ruoyi.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TravelGuideMapper;
import com.ruoyi.system.domain.TravelGuide;
import com.ruoyi.system.service.ITravelGuideService;

/**
 * 攻略Service业务层处理
 *
 * @author Y.C
 * @date 2024-02-21
 */
@Service
public class TravelGuideServiceImpl extends ServiceImpl<TravelGuideMapper,TravelGuide> implements ITravelGuideService
{
    @Autowired
    private TravelGuideMapper travelGuideMapper;

    /**
     * 查询攻略
     *
     * @param strategyId 攻略主键
     * @return 攻略
     */
    @Override
    public TravelGuide selectTravelGuideByStrategyId(Long strategyId)
    {
        return travelGuideMapper.selectTravelGuideByStrategyId(strategyId);
    }

    /**
     * 查询攻略列表
     *
     * @param travelGuide 攻略
     * @return 攻略
     */
    @Override
    public List<TravelGuide> selectTravelGuideList(TravelGuide travelGuide)
    {
        return travelGuideMapper.selectTravelGuideList(travelGuide);
    }

    /**
     * 新增攻略
     *
     * @param travelGuide 攻略
     * @return 结果
     */
    @Override
    public int insertTravelGuide(TravelGuide travelGuide)
    {
        travelGuide.setCreateTime(DateUtils.getNowDate());
        return travelGuideMapper.insertTravelGuide(travelGuide);
    }

    /**
     * 修改攻略
     *
     * @param travelGuide 攻略
     * @return 结果
     */
    @Override
    public int updateTravelGuide(TravelGuide travelGuide)
    {
        travelGuide.setUpdateTime(DateUtils.getNowDate());
        return travelGuideMapper.updateTravelGuide(travelGuide);
    }

    /**
     * 批量删除攻略
     *
     * @param strategyIds 需要删除的攻略主键
     * @return 结果
     */
    @Override
    public int deleteTravelGuideByStrategyIds(Long[] strategyIds)
    {
        return travelGuideMapper.deleteTravelGuideByStrategyIds(strategyIds);
    }

    /**
     * 删除攻略信息
     *
     * @param strategyId 攻略主键
     * @return 结果
     */
    @Override
    public int deleteTravelGuideByStrategyId(Long strategyId)
    {
        return travelGuideMapper.deleteTravelGuideByStrategyId(strategyId);
    }
}
